{include file="Public:header2"/}
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <form method="get" team="{:url('/admin/productorder')}" class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">搜索盲盒</label>
                    <div class="layui-input-block">
                        <input type="text" name="keyword" value="{$Request.get.keyword}" placeholder="请输入订单号" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-block">
                        <select name="status" style="width:100%">
                            <option value="">--请选择状态--</option>
                            <!-- <option value="1" {if condition="$Request.get.status eq 1"}selected{/if}>待确认</option> -->
                            <option value="2" {if condition="$Request.get.status eq 2"}selected{/if}>待发货</option>
                            <option value="3" {if condition="$Request.get.status eq 3"}selected{/if}>待收货</option>
                            <option value="4" {if condition="$Request.get.status eq 4"}selected{/if}>已完成</option>
                            <option value="5" {if condition="$Request.get.status eq 5"}selected{/if}>已取消</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </form>

        <div class="layui-card-body">
            <xblock>
                <div style="padding-bottom: 10px;">
                    <a class="layui-btn" href="{:url('/admin/productorderchu',array('keyword'=>$Request.get.keyword,'status'=>$Request.get.status))}">订单导出</a>
                    <span style="line-height:40px;float:right;">共有数据： {$count}条</span>
                </div>
            </xblock>
            <table class="layui-table" style="text-align:center">
                <thead>
                <tr>
                    <th>订单号</th>
                    <th>商品名称</th>
                    <th>商品图片</th>
                    <th>下单用户</th>
                    <th>订单状态</th>
                    <th>下单时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                    {volist name="list" id="vo"}
                        <tr>
                            <td>{$vo['order_num']}</td>
                            <td>{$vo['title']}</td>
                            <td><img src="{php} echo imageUrl($vo['imgurl']) {/php}" width="60px" height="60px"></td>
                            <td>{$vo['mobile']}</td>
                            
                            <td>
                                {if condition="$vo['status'] eq 1"}
                                    待确认(未支付)
                                {elseif condition="$vo['status'] eq 2" /}
                                    待发货
                                {elseif condition="$vo['status'] eq 3" /}
                                    待收货
                                {elseif condition="$vo['status'] eq 4" /}
                                    已完成
                                {elseif condition="$vo['status'] eq 5" /}
                                    已取消
                                {/if}
                            </td>
                            <td>{$vo['addtime']|date="Y-m-d H:i:s"}</td>
                            <td>
                                <a title="查看详情" href="{:url('/admin/productorderdetail',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-xs">查看详情</a>
                                {if condition="$vo['status'] eq 2 || $vo['status'] eq 3"}
                                <a onClick="cancel_order({$vo.id})"  class="layui-btn layui-btn-danger layui-btn-xs">取消发货</a>
                                {/if}
                                
                            </td>
                        </tr>
                    {/volist}
                
                        {if condition="empty($list)"}
                            <tr><td colspan='10' style="text-align:center;">暂时没有数据！</td></tr>
                        {/if}
                </tbody>
            </table>
            <div class="my_page layui-box layui-laypage layui-laypage-default">
                {$page|raw}
            </div>
        </div>
    </div>
</div>
{include file="Public:footer"/}
<script type="text/javascript">
    layui.use(['table'], function(){

    });
    
        //订单取消
    function cancel_order(id) {
        layer.confirm('确认要执行删除操作吗？',function(){
            var url = "{:url('/admin/cancel_product_order')}";
            var load=layer.load(2);
            var $ = layui.$;
            $.post(url,{"id":id},function(data){
                if(data.status == 1){
                    layer.msg('取消成功',{icon:1,time:1000},function(){
                        location.reload();
                    });
                }else{
                    layer.msg(data.msg,{icon:2,anim:6,time:1000},function(){
                        layer.close(load);
                    });
                }
            })
        });
    }

</script>
</body>
</html>


